<template>
	<view style="padding-top: 15px;">
		<view class="" style="width: 92%;margin: 0 auto;background-color: #fff;border-radius: 10px;">
			<view class="borders" style="padding:0 30rpx;" v-for="(it,index ) in listdata" :key="index">
				<view class="flex bbo"
					style="border-bottom: 1px solid #ececec;justify-content: space-between;align-items: center;padding: 30rpx 0;">
					<view class="flex" style="flex-direction: column;align-items: flex-start;width: 60%;" >
						<text style="font-weight: 500;font-size: 28rpx;color: #292424;">{{it.memo}}</text>
						<text
							style="font-weight: 400;font-size: 24rpx;color: #292424;opacity: 0.6;padding-top: 10rpx;">{{it.create_time}}</text>
					</view>
					<view class="" style="font-weight: 500;font-size: 28rpx;color: #292424;">
						<text>{{it.type==0?'-':'+'}}{{it.score}}</text>
					</view>
				</view>
			</view>
		</view>
		<!-- 加载更多 -->
		<u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listdata: [],
				page: 1,
				listParams: {
					page: 1,
					pagesize: 15,
				},
				loadStatus: 'loadmore', //loadmore-加载前的状态，loading-加载中的状态，nomore-没有更多的状态
				lastPage: 1,
				isEmpty:false,

			}
		},
		// 触底加载更多
		onReachBottom() {
			if (this.listParams.page < this.lastPage) {
				this.listParams.page += 1;
				this.list();
			}
		},
		onLoad() {
			this.list()
		},
		methods: {
			list() {
				let that = this;
				this.$http('user.logs', {
					type: 3,
					page: this.page,
					pagesize: 15,
				}).then((res) => {
					console.log(res);
					if(res.code == 1){
						that.listdata = [...that.listdata, ...res.data.list];
						that.isEmpty = !that.listdata.length;
						that.lastPage = res.data.count
						that.loadStatus = that.listParams.page < res.data.count ? 'loadmore' : 'nomore';
					}
				})
			},
		}
	}
</script>

<style scoped lang="less">
	.borders:last-child {
		.bbo {
			border-bottom: none !important;
		}

	}
</style>